package cc.lishixi;

import org.apache.pivot.wtk.*;

public class MyFileBrowsing2 extends Window {
    public MyFileBrowsing2() {
        super();
        Border border = new Border();
        BoxPane content = new BoxPane();
        PushButton pushButton = new PushButton("OPEN");
        final MyFileBrowsing2 thiz=this;
        pushButton.getButtonPressListeners().add(new ButtonPressListener() {
            @Override
            public void buttonPressed(Button button) {

                final FileBrowserSheet fileBrowserSheet=new FileBrowserSheet(FileBrowserSheet.Mode.OPEN);
                fileBrowserSheet.open(thiz, new SheetCloseListener() {
                    @Override
                    public void sheetClosed(Sheet sheet) {
                        if(sheet.getResult()){
                            System.out.println(fileBrowserSheet.getSelectedFiles().getLength());
                        }
                    }
                });
            }
        });
        content.add(pushButton);
        border.setContent(content);
    }
}
